package com.cqjtu.tto.controller;

import com.cqjtu.tto.service.ProjectService;
import com.cqjtu.tto.vo.Results;
import com.cqjtu.tto.vo.params.ProAddParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.aspectj.weaver.patterns.PerObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = {"项目接口"})
public class ProjectController {

    @Autowired
    ProjectService projectService;

    @ApiOperation(value="项目添加", notes="开始进行项目")
    @PostMapping("proAdd")
    public Results proAdd(@RequestBody ProAddParam proAddParam) throws InterruptedException { return projectService.addProject(proAddParam);}

    @ApiOperation(value="客户评价", notes="客户对于总体项目的评价")
    @PostMapping("CusEvaluation")
    public Results cusEvalu(Long pro_id,String evaluation){ return projectService.CusEvaluate(pro_id,evaluation);}

    @ApiOperation(value="获取项目", notes="获取全部员工的实时监控信息")
    @GetMapping("proSelectOne")
    public Results proOne(String pro_name){ return projectService.proselectOne(pro_name);}

    @ApiOperation(value="获取全部项目", notes="获取全部项目")
    @GetMapping("proSelectAll")
    public Results proAll(){ return projectService.proAll();}   //该用户下未结束的所有项目

    @ApiOperation(value="获取正在进行的项目", notes="获取正在进行的项目")
    @GetMapping("proSelectAllNow")
    public Results proAllNow(Long user_id){ return projectService.proselectAllnow(user_id);}   //该用户下未结束的所有项目

    @ApiOperation(value="获取已经结束的项目", notes="获取已经结束的项目")
    @GetMapping("proSelectAllEnd")
    public Results proAllEnd(Long user_id){ return projectService.proselectAllEnd(user_id);}   //该用户下未结束的所有项目

    @ApiOperation(value="获取正在进行的项目阶段信息", notes="获取正在进行的项目阶段")
    @GetMapping("proStageNow")
    public Results proStageNow(Long project_id){return projectService.proStageNow(project_id);}

    @ApiOperation(value="阶段评价", notes="对阶段进行评价")
    @PostMapping("StageEvaluation")
    public Results StageEvaluation(Long pro_id,Long stage_id,String evaluation,Integer score){return projectService.StageEvaluate(pro_id,stage_id,evaluation,score);}

    @ApiOperation(value="阶段进行", notes="进行下一阶段")
    @PostMapping("NextStage")
    public Results NextStage(Long pro_id) throws InterruptedException {return projectService.NextStage(pro_id);}

    @ApiOperation(value="结束项目", notes="结束项目")
    @PostMapping("EndProject")
    public Results EndProject(Long pro_id,Float pro_income,String evaluation){return projectService.EndProject(pro_id,pro_income,evaluation);}

    @ApiOperation(value="项目回退", notes="项目回退")
    @PostMapping("BackProject")
    public Results BackProject(Long pro_id,String stage_name){return projectService.BackProject(pro_id,stage_name);}
}
